<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>API编辑</title>
    <link rel="stylesheet" type="text/css" href="__LAYUI__/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/common/css/admin.css" />
</head>

<body>

<!--API设置-->
<form class="layui-form" style="width: 90%;padding-top: 20px;">
    <div class="layui-form-item">
        <label class="layui-form-label">提现金额：</label>
        <div class="layui-input-block">
            <input type="text" readonly aria-disabled="true" placeholder="提交共钥后自动生成"  disabled autocomplete="off" class="layui-input" value="{$api.key|default='提交共钥后自动生成'}">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">共钥：</label>
        <div class="layui-input-block">
            <textarea name="secretkey" placeholder="请输入私钥" class="layui-textarea">{$api.secretkey|default=''}</textarea>
            <div class="layui-form-mid layui-word-aux">商户请求加密/验签公钥（私钥商户自行保留）</div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="apply">申请提现</button>
        </div>
    </div>
</form>

<script src="__LAYUI__/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="__LAYUI__/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    //Demo
    layui.use(['form','jquery', 'upload', 'element'], function(index) {
        var form = layui.form(),
            $ = layui.jquery,
            element = layui.element();
        form.render();

        layui.upload({
            url: '/upload',
            success: function(res) {
                console.log(res); //上传成功返回值，必须为json格式
            }
        });
        //监听API提交
        form.on('submit(apply)', function(data) {
            $.post("{:url('balance/apply')}",data.field,function (res) {
                    layer.alert(res.msg,{title: "修改状态", btn: ['确定']},function () {
                        refresh(index);
                    });
                }
            );
            return false;
        });
    });
</script>
</body>

</html>